import Vue from 'vue'
import moment from 'moment'

//时间格式化
Vue.prototype.$timeFormat = (time, keyword) => {
  keyword = keyword || 'YYYY-MM-DD'
  if (time && time != '' && time != null) {
    return moment(time).format(keyword)
  } else return '-'
}

//字典表转化
Vue.prototype.$getDict = (list, key) => {
  let name = '-';
  console.log("list",list)
  if (list && list.length) {
    list.forEach(item => {
      if (item.value == key) {
        name = item.label
      }
    })
  }
  return name
}

Vue.prototype.$ExpReg = {
  acount: /^[A-Za-z0-9]+$/,
  phone: /^1[3,5,6,8,9]\d{9}$/,
  pw: /^\w{6,16}$/
}
